<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>oauth2client.client.OAuth2Credentials</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="oauth2client-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="oauth2client-module.html">Package&nbsp;oauth2client</a> ::
        <a href="oauth2client.client-module.html">Module&nbsp;client</a> ::
        Class&nbsp;OAuth2Credentials
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="oauth2client.client.OAuth2Credentials-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class OAuth2Credentials</h1><p class="nomargin-top"><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials">source&nbsp;code</a></span></p>
<center>
<center>  <map id="uml_class_diagram_for_oauth2cl_28" name="uml_class_diagram_for_oauth2cl_28">
<area shape="rect" id="node1_14" href="oauth2client.client.OAuth2Credentials-class.html#__init__" title="Create an instance of OAuth2Credentials." alt="" coords="18,124,982,143"/>
<area shape="rect" id="node1_15" href="oauth2client.client.OAuth2Credentials-class.html#authorize" title="Authorize an httplib2.Http instance with these credentials." alt="" coords="18,143,982,161"/>
<area shape="rect" id="node1_16" href="oauth2client.client.OAuth2Credentials-class.html#refresh" title="Forces a refresh of the access_token." alt="" coords="18,161,982,180"/>
<area shape="rect" id="node1_17" href="oauth2client.client.OAuth2Credentials-class.html#revoke" title="Revokes a refresh_token and makes the credentials void." alt="" coords="18,180,982,199"/>
<area shape="rect" id="node1_18" href="oauth2client.client.OAuth2Credentials-class.html#apply" title="Add the authorization to the headers." alt="" coords="18,199,982,217"/>
<area shape="rect" id="node1_19" href="oauth2client.client.OAuth2Credentials-class.html#to_json" title="Creating a JSON representation of an instance of Credentials." alt="" coords="18,217,982,236"/>
<area shape="rect" id="node1_20" href="oauth2client.client.OAuth2Credentials-class.html#from_json" title="Instantiate a Credentials object from a JSON description of it." alt="" coords="18,236,982,255"/>
<area shape="rect" id="node1_21" href="oauth2client.client.OAuth2Credentials-class.html#access_token_expired" title="True if the credential is expired or invalid." alt="" coords="18,255,982,273"/>
<area shape="rect" id="node1_22" href="oauth2client.client.OAuth2Credentials-class.html#get_access_token" title="Return the access token and its expiration information." alt="" coords="18,273,982,292"/>
<area shape="rect" id="node1_23" href="oauth2client.client.OAuth2Credentials-class.html#set_store" title="Set the Storage for the credential." alt="" coords="18,292,982,311"/>
<area shape="rect" id="node1_24" href="oauth2client.client.OAuth2Credentials-class.html#__getstate__" title="Trim the state down to something that can be pickled." alt="" coords="18,311,982,329"/>
<area shape="rect" id="node1_25" href="oauth2client.client.OAuth2Credentials-class.html#__setstate__" title="Reconstitute the state of the object from being pickled." alt="" coords="18,329,982,348"/>
<area shape="rect" id="node1" href="oauth2client.client.OAuth2Credentials-class.html" title="Credentials object for OAuth 2.0." alt="" coords="5,93,993,355"/>
<area shape="rect" id="node2_26" href="oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS" title="oauth2client.client.Credentials.NON_SERIALIZED_MEMBERS" alt="" coords="403,28,598,47"/>
<area shape="rect" id="node2_27" href="oauth2client.client.Credentials-class.html#new_from_json" title="Utility class method to instantiate a Credentials subclass from a JSON representation produced by to_json()." alt="" coords="403,49,598,68"/>
<area shape="rect" id="node2" href="oauth2client.client.Credentials-class.html" title="Base class for all Credentials objects." alt="" coords="391,5,610,75"/>
</map>
  <img src="uml_class_diagram_for_oauth2cl_28.gif" alt='' usemap="#uml_class_diagram_for_oauth2cl_28" ismap="ismap" class="graph-without-title" />
</center>
</center>
<hr />
<pre class="literalblock">
Credentials object for OAuth 2.0.

Credentials can be applied to an httplib2.Http object using the authorize()
method, which then adds the OAuth 2.0 access token to each request.

OAuth2Credentials objects may be safely pickled and unpickled.

</pre>

<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">access_token</span>,
        <span class="summary-sig-arg">client_id</span>,
        <span class="summary-sig-arg">client_secret</span>,
        <span class="summary-sig-arg">refresh_token</span>,
        <span class="summary-sig-arg">token_expiry</span>,
        <span class="summary-sig-arg">token_uri</span>,
        <span class="summary-sig-arg">user_agent</span>,
        <span class="summary-sig-arg">revoke_uri</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">id_token</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">token_response</span>=<span class="summary-sig-default">None</span>)</span><br />
      Create an instance of OAuth2Credentials.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#authorize" class="summary-sig-name">authorize</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">http</span>)</span><br />
      Authorize an httplib2.Http instance with these credentials.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.authorize">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#refresh" class="summary-sig-name">refresh</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">http</span>)</span><br />
      Forces a refresh of the access_token.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.refresh">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#revoke" class="summary-sig-name">revoke</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">http</span>)</span><br />
      Revokes a refresh_token and makes the credentials void.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.revoke">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#apply" class="summary-sig-name">apply</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">headers</span>)</span><br />
      Add the authorization to the headers.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.apply">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#to_json" class="summary-sig-name">to_json</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Creating a JSON representation of an instance of Credentials.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.to_json">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#access_token_expired" class="summary-sig-name">access_token_expired</a>(<span class="summary-sig-arg">self</span>)</span><br />
      True if the credential is expired or invalid.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.access_token_expired">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#get_access_token" class="summary-sig-name">get_access_token</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">http</span>=<span class="summary-sig-default">None</span>)</span><br />
      Return the access token and its expiration information.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.get_access_token">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#set_store" class="summary-sig-name">set_store</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">store</span>)</span><br />
      Set the Storage for the credential.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.set_store">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#_expires_in" class="summary-sig-name" onclick="show_private();">_expires_in</a>(<span class="summary-sig-arg">self</span>)</span><br />
      Return the number of seconds until this token expires.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._expires_in">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_updateFromCredential"></a><span class="summary-sig-name">_updateFromCredential</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">other</span>)</span><br />
      Update this Credential from another instance.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._updateFromCredential">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__getstate__"></a><span class="summary-sig-name">__getstate__</span>(<span class="summary-sig-arg">self</span>)</span><br />
      Trim the state down to something that can be pickled.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.__getstate__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__setstate__"></a><span class="summary-sig-name">__setstate__</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">state</span>)</span><br />
      Reconstitute the state of the object from being pickled.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.__setstate__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_generate_refresh_request_body"></a><span class="summary-sig-name">_generate_refresh_request_body</span>(<span class="summary-sig-arg">self</span>)</span><br />
      Generate the body that will be used in the refresh request.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._generate_refresh_request_body">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="_generate_refresh_request_headers"></a><span class="summary-sig-name">_generate_refresh_request_headers</span>(<span class="summary-sig-arg">self</span>)</span><br />
      Generate the headers that will be used in the refresh request.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._generate_refresh_request_headers">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#_refresh" class="summary-sig-name" onclick="show_private();">_refresh</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">http_request</span>)</span><br />
      Refreshes the access_token.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._refresh">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#_do_refresh_request" class="summary-sig-name" onclick="show_private();">_do_refresh_request</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">http_request</span>)</span><br />
      Refresh the access_token using the refresh_token.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._do_refresh_request">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#_revoke" class="summary-sig-name" onclick="show_private();">_revoke</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">http_request</span>)</span><br />
      Revokes the refresh_token and deletes the store if available.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._revoke">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#_do_revoke" class="summary-sig-name" onclick="show_private();">_do_revoke</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">http_request</span>,
        <span class="summary-sig-arg">token</span>)</span><br />
      Revokes the credentials and deletes the store if available.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._do_revoke">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <div class="private">    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="oauth2client.client.Credentials-class.html">Credentials</a></code></b> (private):
      <code><a href="oauth2client.client.Credentials-class.html#_to_json" onclick="show_private();">_to_json</a></code>
      </p></div>
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__delattr__</code>,
      <code>__format__</code>,
      <code>__getattribute__</code>,
      <code>__hash__</code>,
      <code>__new__</code>,
      <code>__reduce__</code>,
      <code>__reduce_ex__</code>,
      <code>__repr__</code>,
      <code>__setattr__</code>,
      <code>__sizeof__</code>,
      <code>__str__</code>,
      <code>__subclasshook__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== CLASS METHODS ==================== -->
<a name="section-ClassMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Class Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-ClassMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="oauth2client.client.OAuth2Credentials-class.html#from_json" class="summary-sig-name">from_json</a>(<span class="summary-sig-arg">cls</span>,
        <span class="summary-sig-arg">s</span>)</span><br />
      Instantiate a Credentials object from a JSON description of it.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.from_json">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="oauth2client.client.Credentials-class.html">Credentials</a></code></b>:
      <code><a href="oauth2client.client.Credentials-class.html#new_from_json">new_from_json</a></code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== CLASS VARIABLES ==================== -->
<a name="section-ClassVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Class Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-ClassVariables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code><a href="oauth2client.client.Credentials-class.html">Credentials</a></code></b>:
      <code><a href="oauth2client.client.Credentials-class.html#NON_SERIALIZED_MEMBERS">NON_SERIALIZED_MEMBERS</a></code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== PROPERTIES ==================== -->
<a name="section-Properties"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Properties</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Properties"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr>
    <td colspan="2" class="summary">
    <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>:
      <code>__class__</code>
      </p>
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="__init__"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">access_token</span>,
        <span class="sig-arg">client_id</span>,
        <span class="sig-arg">client_secret</span>,
        <span class="sig-arg">refresh_token</span>,
        <span class="sig-arg">token_expiry</span>,
        <span class="sig-arg">token_uri</span>,
        <span class="sig-arg">user_agent</span>,
        <span class="sig-arg">revoke_uri</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">id_token</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">token_response</span>=<span class="sig-default">None</span>)</span>
    <br /><em class="fname">(Constructor)</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.__init__">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Create an instance of OAuth2Credentials.

This constructor is not usually called by the user, instead
OAuth2Credentials objects are instantiated by the OAuth2WebServerFlow.

Args:
  access_token: string, access token.
  client_id: string, client identifier.
  client_secret: string, client secret.
  refresh_token: string, refresh token.
  token_expiry: datetime, when the access_token expires.
  token_uri: string, URI of token endpoint.
  user_agent: string, The HTTP User-Agent to provide for this application.
  revoke_uri: string, URI for revoke endpoint. Defaults to None; a token
    can't be revoked if this is None.
  id_token: object, The identity of the resource owner.
  token_response: dict, the decoded response to the token request. None
    if a token hasn't been requested yet. Stored because some providers
    (e.g. wordpress.com) include extra fields that clients may want.

Notes:
  store: callable, A callable that when passed a Credential
    will store the credential back to where it came from.
    This is needed to store the latest access_token if it
    has expired and been refreshed.

</pre>
  <dl class="fields">
    <dt>Decorators:</dt>
    <dd><ul class="nomargin-top">
        <li><code>@util.positional(8)</code></li>
    </ul></dd>
    <dt>Overrides:
        object.__init__
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="authorize"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">authorize</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">http</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.authorize">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Authorize an httplib2.Http instance with these credentials.

The modified http.request method will add authentication headers to each
request and will refresh access_tokens when a 401 is received on a
request. In addition the http.request method has a credentials property,
http.request.credentials, which is the Credentials object that authorized
it.

Args:
   http: An instance of httplib2.Http
     or something that acts like it.

Returns:
   A modified instance of http that was passed in.

Example:

  h = httplib2.Http()
  h = credentials.authorize(h)

You can't create a new OAuth subclass of httplib2.Authentication
because it never gets passed the absolute URI, which is needed for
signing. So instead we have to overload 'request' with a closure
that adds in the Authorization header and then calls the original
version of 'request()'.

</pre>
  <dl class="fields">
    <dt>Overrides:
        <a href="oauth2client.client.Credentials-class.html#authorize">Credentials.authorize</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="refresh"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">refresh</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">http</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.refresh">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Forces a refresh of the access_token.

Args:
  http: httplib2.Http, an http object to be used to make the refresh
    request.

</pre>
  <dl class="fields">
    <dt>Overrides:
        <a href="oauth2client.client.Credentials-class.html#refresh">Credentials.refresh</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="revoke"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">revoke</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">http</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.revoke">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Revokes a refresh_token and makes the credentials void.

Args:
  http: httplib2.Http, an http object to be used to make the revoke
    request.

</pre>
  <dl class="fields">
    <dt>Overrides:
        <a href="oauth2client.client.Credentials-class.html#revoke">Credentials.revoke</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="apply"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">apply</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">headers</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.apply">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Add the authorization to the headers.

Args:
  headers: dict, the headers to add the Authorization header to.

</pre>
  <dl class="fields">
    <dt>Overrides:
        <a href="oauth2client.client.Credentials-class.html#apply">Credentials.apply</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="to_json"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">to_json</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.to_json">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Creating a JSON representation of an instance of Credentials.

Returns:
   string, a JSON representation of this instance, suitable to pass to
   from_json().

</pre>
  <dl class="fields">
    <dt>Overrides:
        <a href="oauth2client.client.Credentials-class.html#to_json">Credentials.to_json</a>
        <dd><em class="note">(inherited documentation)</em></dd>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="from_json"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">from_json</span>(<span class="sig-arg">cls</span>,
        <span class="sig-arg">s</span>)</span>
    <br /><em class="fname">Class Method</em>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.from_json">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Instantiate a Credentials object from a JSON description of it. The JSON
should have been produced by calling .to_json() on the object.

Args:
  data: dict, A deserialized JSON object.

Returns:
  An instance of a Credentials subclass.

</pre>
  <dl class="fields">
    <dt>Overrides:
        <a href="oauth2client.client.Credentials-class.html#from_json">Credentials.from_json</a>
    </dt>
  </dl>
</td></tr></table>
</div>
<a name="access_token_expired"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">access_token_expired</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.access_token_expired">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
True if the credential is expired or invalid.

If the token_expiry isn't set, we assume the token doesn't expire.

</pre>
  <dl class="fields">
    <dt>Decorators:</dt>
    <dd><ul class="nomargin-top">
        <li><code>@property</code></li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="get_access_token"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">get_access_token</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">http</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.get_access_token">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return the access token and its expiration information.

If the token does not exist, get one.
If the token expired, refresh it.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="set_store"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">set_store</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">store</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials.set_store">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Set the Storage for the credential.

Args:
  store: Storage, an implementation of Storage object.
    This is needed to store the latest access_token if it
    has expired and been refreshed. This implementation uses
    locking to check for updates before updating the
    access_token.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_expires_in"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_expires_in</span>(<span class="sig-arg">self</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._expires_in">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return the number of seconds until this token expires.

If token_expiry is in the past, this method will return 0, meaning the
token has already expired.
If token_expiry is None, this method will return None. Note that returning
0 in such a case would not be fair: the token may still be valid;
we just don't know anything about it.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_refresh"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_refresh</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">http_request</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._refresh">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Refreshes the access_token.

This method first checks by reading the Storage object if available.
If a refresh is still needed, it holds the Storage lock until the
refresh is completed.

Args:
  http_request: callable, a callable that matches the method signature of
    httplib2.Http.request, used to make the refresh request.

Raises:
  AccessTokenRefreshError: When the refresh fails.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_do_refresh_request"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_do_refresh_request</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">http_request</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._do_refresh_request">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Refresh the access_token using the refresh_token.

Args:
  http_request: callable, a callable that matches the method signature of
    httplib2.Http.request, used to make the refresh request.

Raises:
  AccessTokenRefreshError: When the refresh fails.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_revoke"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_revoke</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">http_request</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._revoke">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Revokes the refresh_token and deletes the store if available.

Args:
  http_request: callable, a callable that matches the method signature of
    httplib2.Http.request, used to make the revoke request.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="_do_revoke"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">_do_revoke</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">http_request</span>,
        <span class="sig-arg">token</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="oauth2client.client-pysrc.html#OAuth2Credentials._do_revoke">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Revokes the credentials and deletes the store if available.

Args:
  http_request: callable, a callable that matches the method signature of
    httplib2.Http.request, used to make the refresh request.
  token: A string used as the token to be revoked. Can be either an
    access_token or refresh_token.

Raises:
  TokenRevokeError: If the revoke request does not return with a 200 OK.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="oauth2client-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Mon Sep 29 15:21:52 2014
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
